// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace Microsoft.DotNet.Interactive.CSharpProject;

public class ProjectDiagnostics : ReadOnlyCollection<SerializableDiagnostic>, IRunResultFeature
{
    public ProjectDiagnostics(IEnumerable<SerializableDiagnostic> diagnostics) : base(diagnostics.ToArray())
    {
    }

    public string Name => nameof(ProjectDiagnostics);

    public void Apply(FeatureContainer result)
    {
        result.AddProperty("projectDiagnostics", this.Sort());
    }
}